import java.sql.SQLException;
import java.util.Map;


public abstract class Template {
	public static final int CARDINALITY_PARTSUPP = 800000;
	public static final int CARDINALITY_ORDERS = 1500000;
	public static final int CARDINALITY_PART = 200000;
	public static final int CARDINALITY_SUPPLIER = 10000;
	public static final int CARDINALITY_NATION = 25;
	public static final int CARDINALITY_CUSTOMER = 150000;
	public static final int CARDINALITY_REGION = 5;
	public static final int CARDINALITY_LINEITEM = 6000000;
	public String[] tables = {"customer","lineitem", "nation","orders","part", "partsupp", "region", "supplier"};
	public abstract void configure(Map<String, Object> params);
	public abstract Map<String, Object> insertLineItems(int nInsertsLineItem) throws SQLException;
	public abstract int query1();
	public abstract int query2();
	public abstract int query3();
	public abstract int query4();
	public abstract void getDataForQueries() throws SQLException;
	public abstract int	deleteData();
	
	protected double scaleFactor;
	protected int nInsertsPartsuppExpected;
	protected int nInsertsPartExpected;
	protected int nInsertsNationExpected;
	protected int nInsertsRegionExpected;
	protected int nInsertsCustomerExpected;
	protected int nInsertsOrdersExpected;
	protected int nInsertsSupplierExpected;
	
	protected void calculateScaleFactor(int nRegs) {
		double dScaleFactor = (double) nRegs/(double) CARDINALITY_LINEITEM;
		scaleFactor = dScaleFactor;
	}
	
	protected void calculateInsertsExpected(int nRegs) {
		calculateScaleFactor(nRegs);
		nInsertsPartsuppExpected = (int) (scaleFactor * CARDINALITY_PARTSUPP);
		nInsertsPartExpected = (int) (scaleFactor * CARDINALITY_PART);
		nInsertsNationExpected = (int) (CARDINALITY_NATION);
		nInsertsRegionExpected = (int) (CARDINALITY_REGION);
		nInsertsCustomerExpected = (int) (scaleFactor * CARDINALITY_CUSTOMER);
		nInsertsOrdersExpected = (int) (scaleFactor * CARDINALITY_ORDERS);
		nInsertsSupplierExpected = (int) (scaleFactor * CARDINALITY_SUPPLIER);
	}
}
